<template>
  <div class="new-card">
    <div class="colors">
      <p
        class="color-li"
        v-for="(e, index) in cardColorBlock"
        :key="index"
        :style="{ background: e }"
        :class="{ colorselected: index == colorSelected }"
        @click="changeColor(index)"
      ></p>
    </div>
    <div
      class="card-main"
      :style="{ background: cardColorBlock[colorSelected] }"
    >
      <textarea placeholder="留言" class="message" maxlength="144" v-model="message"></textarea>
      <input type="text" placeholder="签名" class="name" v-model="name" />
    </div>
    <div class="labels">
      <p class="title">选择标签</p>
      <div class="label">
        <p
          v-for="(e, index) in label[id]"
          :key="index"
          class="label-item"
          :class="{ labelselected: index == labelSelected }"
          @click="changeLabel(index)"
        >
          {{ e }}
        </p>
      </div>
    </div>
    <div>
      <p class="title">免责声明</p>
      <p class="mzsm">
        一刻时光是本人独自开发的，为便于与用户交流的留言平台。请不要利用此平台服务制作、上传、下载、复制、发布、传播或者转载如下内容：<br />
        1、反对宪法所确定的基本原则的；<br />
        2、危害国家安全，泄露国家秘密，颠覆国家政权，破坏国家 统一的；<br />
        3、损害国家荣誉和利益的；<br />
        4、煽动民族仇恨、民族歧视，破坏民族团结的；<br />
        5、破坏国家宗教政策，宣扬邪教和封建迷信的；<br />
        6、散布谣言，扰乱社会秩序，破坏社会稳定的；<br />
        7、散布淫秽、色情、赌博、暴力、凶杀、恐怖或者教唆犯罪的；<br />
        8、侮辱或者诽谤他人，侵害他人合法权益的；<br />
        9、含有法律、行政法规禁止的其他内容的信息。
      </p>
    </div>
    <div class="btn1">
      <Button size="max" nom="secondary" @click="closeModal">丢弃</Button>
      <Button size="max" class="sbumit" @click="submit">确定</Button>
    </div>
  </div>
</template>

<script>
import { cardColorBlock, label } from "@/static/data";
import Button from "./Button.vue";
export default {
  data() {
    return {
      cardColorBlock,
      colorSelected: 0,
      label,
      labelSelected: 0,
      message:'',
      name:'',
    };
  },
  props: {
    id: {
      default: 0,
    },
  },
  components:{Button,},
  methods: {
    changeColor(e) {
      this.colorSelected = e;
    },
    changeLabel(e) {
      this.labelSelected = e;
    },
    closeModal(data){
      this.$emit('addClose',data);
    }
  },
};
</script>

<style lang="less" scoped>
.new-card {
  padding: 0 20px 95px;
  position: relative;

  .colors {
    display: flex;
    align-items: center;
    padding-bottom: 12px;
  }
  .color-li {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
  }

  .colorselected {
    border: 1px solid #3b73f0;
  }
}

.card-main {
  position: relative;
  height: 215px;
  width: 100%;
  // background: rgba(252, 175, 162, 0.31);
  padding: 12px;
  box-sizing: border-box;
  transition: all 0.3s;

  .message {
    background: none;
    border: none;
    resize: none;
    height: 140px;
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    font-size: 12px;
    font-family: "Courier New", Courier, monospace;
  }

  .name {
    width: 100%;
    line-height: 20px;
    box-sizing: border-box;
    padding: 8px;
    background: none;
    border: 1px solid #fff;
    font-size: 16px;
    font-family: "Courier New", Courier, monospace;
  }
}

.title {
  color: #202020;
  font-weight: 600;
  padding-top: 16px;
}

.label {
  display: flex;
  flex-wrap: wrap;
  width: 270px;
  cursor: pointer;
  user-select: none;

  .label-item {
    padding: 2px 8px;
    border-radius: 20px;
    margin: 10px 0px 0 0;
    color: #5b5b5b;
    transition: all 0.3s;
  }

  .labelselected {
    background: #ebebeb;
    font-weight: 600;
    color: #202020;
  }
}
.mzsm {
    padding-top: 5px;
    font-size: 12px;
    color: #949494;

}

.btn1 {
    position: fixed;
    display: flex;
    padding: 16px;
    box-sizing: border-box;
    bottom: 45px;
    left: 0;
    background: rgba(255, 255, 255, 0.4);
    width: 100%;
    backdrop-filter: blur(10px);

    .sbumit {
        margin-left: 20px;
        width: 200px;
    }
 }

// .add-photo {
//     padding-bottom: 20px;
//     position: relative;

//     #file {
//         position: absolute;
//         z-index: 10;
//         top: -10;
//         height: 74px;
//         width: 64px;
//         opacity: 0;
//         cursor: pointer;
//     }

//     .add-bt {
//         width: 64px;
//         height: 64px;
//         border: 1px solid @gray-3;
//         border-radius: 32px;
//         display: flex;
//         align-items: center;
//         justify-content: center;
//         cursor: pointer;
//     }

//     .icon-tianjia {
//         font-size: 24px;
//     }

//     .photo-div {
//         max-height: 100%;
//         width: 100%;
//         height: 100%;
//         background: #f0f0f0;
//         overflow: hidden;

//         img {
//             width: 100%;
//             height: 100%;
//         }
//     }

//     .change-bt {
//         position: absolute;
//         top: 12px;
//         left: 12px;
//         height: 40px;
//         width: 40px;
//         border-radius: 50%;
//         background: rgba(0, 0, 0, 0.3);
//         display: flex;
//         align-items: center;
//         justify-content: center;

//         .icon-xiugai {
//             color: #fff;
//         }
//     }

// }
</style>